home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _SCROLL.C < prev    next >
Text File  |  1992-11-21  |  4KB  |  124 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__scroll = "$Header: c:/curses/private/RCS/_scroll.c%v 2.0 1992/11/15 03:24:34 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_scroll() - low level screen scroll
  14.  
  15.   PDCurses Description:
  16.        Scrolls a window in the current page up or down. Urow, lcol,
  17.        lrow, rcol are the window coordinates.  Lines is the number of
  18.        lines to scroll. If 0, clears the window, if < 0 scrolls down,
  19.        if > 0 scrolls up.  Blanks areas that are left, and sets
  20.        character attributes to attr. If in a colour graphics mode,
  21.        fills them with the colour 'attr' instead.
  22.  
  23.   PDCurses Return Value:
  24.        The PDC_scroll() function returns OK on success otherwise ERR is returned.
  25.  
  26.   PDCurses Errors:
  27.        An error will only be returned on the Flexos platform if s_copy()
  28.        fails.
  29.  
  30.   Portability:
  31.        PDCurses        int PDC_scroll( int urow, int lcol, int rcol,
  32.                                     int lines, chtype attr );
  33.  
  34. **man-end**********************************************************************/
  35.  
  36. int    PDC_scroll(int urow, int lcol, int lrow, int rcol, int lines, chtype attr)
  37. {
  38. #ifdef FLEXOS
  39.        int     srow;
  40.        int     scol;
  41.        int     drow;
  42.        int     dcol;
  43.        int     nrows
  44.        int     ncols;
  45.        char    blank = (char) _cursvar.blank;
  46.  
  47.        if (lines == 0)
  48.        {
  49.                sframe.fr_pl[0] = (UBYTE *) & blank;
  50.                sframe.fr_pl[1] = (UBYTE *) & attr;
  51.                sframe.fr_pl[2] = (UBYTE *) " ";
  52.                sframe.fr_nrow = 1;
  53.                sframe.fr_ncol = 1;
  54.                sframe.fr_use = 0x00;
  55.                nrows = lrow;
  56.                ncols = rcol;
  57.                srow = drow = 0;
  58.                scol = dcol = 0;
  59.        }
  60.        else
  61.        if (lines < 0)
  62.        {
  63.                srow = urow;
  64.                scol = lcol;
  65.                drow = lrow;
  66.                dcol = rcol;
  67.        }
  68.        else
  69.        if (lines > 0)
  70.        {
  71.                srow = urow;
  72.                scol = lcol;
  73.                drow = lrow;
  74.                dcol = lcol;
  75.        }
  76.  
  77.        drect.r_row = drow;
  78.        drect.r_col = dcol;
  79.        drect.r_nrow = nrows;
  80.        drect.r_ncol = ncols;
  81.  
  82.        srect.r_col = scol;
  83.        srect.r_row = srow;
  84.        srect.r_nrow = nrows;
  85.        srect.r_ncol = ncols;
  86.  
  87.        if (lines != 0)
  88.                retcode = s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect, 0L, (far unsigned short *) &srect);
  89.        else
  90.                retcode = s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect, (far unsigned short *) &sframe, (far unsigned short *) &srect);
  91.        return( (retcode < 0L) ? ERR : OK );
  92. #endif
  93. #ifdef DOS
  94.        if (lines >= 0)
  95.        {
  96.                regs.h.ah = 0x06;
  97.                regs.h.al = (unsigned char) lines;
  98.        }
  99.        else
  100.        {
  101.                regs.h.ah = 0x07;
  102.                regs.h.al = (unsigned char) (-lines);
  103.        }
  104.        regs.h.bh = (unsigned char)((attr & A_ATTRIBUTES) >> 8);
  105.        regs.h.ch = (unsigned char) urow;
  106.        regs.h.cl = (unsigned char) lcol;
  107.        regs.h.dh = (unsigned char) lrow;
  108.        regs.h.dl = (unsigned char) rcol;
  109.        int86(0x10, ®s, ®s);
  110.        return( OK );
  111. #endif
  112. #ifdef OS2
  113.        USHORT ch=((attr << 8) & _cursvar.blank);
  114.        if (lines > 0)
  115.                VioScrollUp(urow, lcol, lrow, rcol, lines, (PBYTE)&ch, 0);
  116.        else
  117.                if (lines < 0)
  118.                        VioScrollDn(urow, lcol, lrow, rcol, lines, (PBYTE)&ch, 0);
  119.                else
  120. /* this clears the whole screen */
  121.                        VioScrollUp(0, 0, -1, -1, -1, (PBYTE)&ch, 0);
  122. #endif
  123. }
  124.